package eudjok

class YouTubeVideo {
	
	List<String> thumbnails;
	List<YouTubeMedia> medias;
	String webPlayerUrl;
	String embeddedWebPlayerUrl;
    String title;
    String description;
    String user;
    String videoId;
    
	
	String getVideoId() {
		return videoId;
	}
	void setVideoId(String videoId) {
		this.videoId = videoId;
	}
	String getTitle() {
		return title;
	}
	void setTitle(String title) {
		this.title = title;
	}
	String getDescription() {
		return description;
	}
	void setDescription(String description) {
		this.description = description;
	}
	String getUser() {
		return user;
	}
	void setUser(String user) {
		this.user = user;
	}
	List<String> getThumbnails() {
		return thumbnails;
	}
	void setThumbnails(List<String> thumbnails) {
		this.thumbnails = thumbnails;
	}

	List<YouTubeMedia> getMedias() {
		return medias;
	}
	void setMedias(List<YouTubeMedia> medias) {
		this.medias = medias;
	}
	
	String getWebPlayerUrl() {
		return webPlayerUrl;
	}
	void setWebPlayerUrl(String webPlayerUrl) {
		this.webPlayerUrl = webPlayerUrl;
	}

	String getEmbeddedWebPlayerUrl() {
		return embeddedWebPlayerUrl;
	}
	void setEmbeddedWebPlayerUrl(String embeddedWebPlayerUrl) {
		this.embeddedWebPlayerUrl = embeddedWebPlayerUrl;
	}
	
	String retrieveHttpLocation() {
		if (medias==null || medias.isEmpty()) {
			return null;
		}
		for (YouTubeMedia media : medias) {
			String location = media.getLocation();
			if (location.startsWith("http")) {
				return location;
			}
		}
		return null;
	}
	
    static constraints = {
    }
}
